package com.hopital5.zhangyz.controller;

import com.hopital5.zhangyz.model.ActivityActivityItem;
import com.hopital5.zhangyz.service.ActivityActivityItemService;
import com.hopital5.zhangyz.vo.request.ActivityActivityItemVoRequest;
import com.hopital5.zhangyz.vo.response.ActivityActivityItemVoResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/activityActivityItem")
public class ActivityActivityItemController extends BaseController {
    @Autowired
    ActivityActivityItemService activityActivityItemService;

    @PostMapping
    public List<ActivityActivityItemVoResponse> update(@RequestBody List<ActivityActivityItemVoRequest> activityActivityItemVoRequests) {
        return activityActivityItemService.update(activityActivityItemVoRequests).stream().map(ActivityActivityItemVoResponse::build).collect(Collectors.toList());
    }
}
